package com.thezukunft.wave.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.ui.RootPanel;
import com.thezukunft.wave.connectormock.WaveMock;


public class GadgetTester implements EntryPoint {

	public void onModuleLoad() {
		
		GinjectorGadgetTester gin = GWT.create(GinjectorGadgetTester.class);
		
		final WaveMock w = (WaveMock) gin.getWave();
		
		// we have to create the gadget using gin so it can use injection
		final YourWaveGadget gadget = gin.getWaveGadget();
		
		
		DeferredCommand.addCommand(new Command() {
			
			@Override
			public void execute() {
				RootPanel.get("gadget").add(gadget);
				
				// initializing random participants will currently generate two fixed ones
				// TODO
				w.initRandomParticipants();
			}
		});
	}

}
